#include "PluginCfg.h"
#include "Od.h"

Config g_Config;

Config::Config()
{
	Od_bBreakInNewModule = NULL;
}

void Config::LoadCfg()
{
	if (Od_bBreakInNewModule)
	{
		bBreakInNewModule = *Od_bBreakInNewModule;
	}

	char modulename[300] = {0};
	Pluginreadstringfromini(hinst, "brkModule", modulename, "");
	bShowMemInfo = Pluginreadintfromini(hinst, "showMemInfo", 1);
	bActiveWhBreak = Pluginreadintfromini(hinst, "active_whenbk", 1);
	strBrkNewModulename = modulename;
	InstallStateInfo(bShowMemInfo);
}

void Config::UpdateOdCfg()
{
	if (Od_bBreakInNewModule)
	{
		*Od_bBreakInNewModule = bBreakInNewModule;
	}

	Pluginwritestringtoini(hinst, "brkModule", (char*)strBrkNewModulename.c_str());
	Pluginwriteinttoini(hinst, "showMemInfo", bShowMemInfo);
	Pluginwriteinttoini(hinst, "active_whenbk", bActiveWhBreak);
	InstallStateInfo(bShowMemInfo);
}
